package com.imu.purse.modules.base.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.imu.core.base.BaseMapper;
import com.imu.purse.modules.base.entity.SysConfigEntity;

/**
 * 系统配置信息
 * 
 * @author sunhongwei
 * @email sunhongwei@gmail.com
 * @date 2017-03-23 15:22:06
 */
public interface SysConfigMapper extends BaseMapper<SysConfigEntity> {
	/****
	 * 更新用户钱包
	 * @param entity
	 */
	@Update({"update sys_config "
	 		+ "set `value` = #{value} "
	 		+ "where `key` = #{key}" })
	public int upByKey(final SysConfigEntity entity);
	
	/**
	 * 根据key，查询value
	 */
	@Select({
		"<script>",
		    "SELECT `id`,",
					"`key`, ",
					"`value`, ",
					"`remark` ",
		    "FROM sys_config ",
		    "WHERE `key` = #{key}",
	    "</script>"
	})
	public SysConfigEntity queryByKey(@Param("key") final String key);
}